<template>
  <div class="app-container">
    <!-- 侧边栏 - 仅在非登录页面显示 -->
    <SiderBar v-if="!isLoginPage" />

    <!-- 页面内容 -->
    <div :class="['page-content', { 'no-sidebar': isLoginPage }]">
      <router-view />
    </div>
  </div>
</template>

<script setup>
import { computed } from 'vue';
import { useRoute } from 'vue-router';
import SiderBar from './components/SiderBar.vue';

const route = useRoute();

// 判断当前是否为登录页面
const isLoginPage = computed(() => {
  return (route.name === 'LoginView' || route.name === 'GeneralView');
});

</script>

<style scoped>
.app-container {
  display: flex;
}

.page-content {
  flex-grow: 1;
}

/* 当侧边栏隐藏时，页面内容不需要左内边距 */
.page-content.no-sidebar {
  padding-left: 0;
}
</style>